package cn.edu.scau.cmi.yangqing.composite_safe;

import java.net.URL;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.yangqing.factory.Creator;
import cn.edu.scau.cmi.yangqing.factory.CreatorPICC;
import cn.edu.scau.cmi.yangqing.factory.CreatorPingan;
import cn.edu.scau.cmi.yangqing.factory.Insurance;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class MyController implements Initializable {

	   @FXML
	   private Button myButton;
	   
	   @FXML
	   private ChoiceBox<String> myChoiceBox;
	   
	   @FXML
	   private TextArea myTextArea;
	   
	   
	   public void initialize(URL location, ResourceBundle resources) {
	   }

	   public void showDateTime(ActionEvent event) {
	       System.out.println("ButtonClass Clicked!");
	       String output = "";
	       
	       System.out.println(myChoiceBox.getSelectionModel().getSelectedIndex());
	       
	       Integer checkboxIndex = myChoiceBox.getSelectionModel().getSelectedIndex();
	  
	       WorldOrganization worldOrganization = null;
	       switch (checkboxIndex) {
			case 0:
				worldOrganization = new China();
				break;
			case 1:
				worldOrganization = new USA();
				break;
			case 2:
				worldOrganization = new England();
				break;
			case 3:
				worldOrganization = new UnitedNations();
				break;
			default:
				break;
		}
	      output = worldOrganization.say();
	      myTextArea.setText(output);
	
	   }
	   
}
